#pragma once
#include <functional>

enum EventType
{
	MOUSE_EVENT,
	KEYBOARD_EVENT
};

enum KeyboardEventType
{
	KEY_DOWN,
	KEY_UP
};

struct Keyboard
{
	KeyboardEventType type;
	int key;
};

enum MouseEventType
{
	BUTTON_DOWN,
	BUTTON_UP,
	CLICK,
	MOUSE_MOVE
};

enum MouseButton
{
	LEFT,
	RIGHT
};

struct Mouse 
{
	MouseEventType type;
	MouseButton button;
	int x;
	int y;
};


struct GuiEvent
{
	EventType type;
	Keyboard key;
	Mouse mouse;
};

class ISubscriber
{
public:
	virtual void callback() = 0;
};

class StaticSubscriber : public ISubscriber
{
	void (*function)(void);
public:
	StaticSubscriber(void (*func)(void));
	void callback();
};


class MemberSubsciber : public ISubscriber
{
	std::tr1::function<void()> func;
public:
	MemberSubsciber(std::tr1::function<void()> f);
	void callback();
};